import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:toast/toast.dart';
import 'package:url_launcher/url_launcher.dart';

import 'package:flutter/services.dart';
class ContactPage extends StatefulWidget {
  ContactPage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<ContactPage> {
  call() async{
const url = 'tel:4000172018';
   if (await canLaunch(url)) {
     await launch(url);
   } else {
     throw 'Could not launch $url';
   }
  }
  // static Future<void> setData(ClipboardData data) async {
  //   await SystemChannels.platform.invokeMethod<void>(
  //     'Clipboard.setData',
  //     <String, dynamic>{
  //       'text': data.text,
  //     },
  //   );
  // }

  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
          title: new Text(
            '联系我们',
            style: TextStyle(color: Colors.black),
          ),
          backgroundColor: Colors.white,
          elevation: 0,
          iconTheme: IconThemeData(
            color: Colors.black, //修改颜色
          ),
        ),
      body: new Container(
          decoration: new BoxDecoration(
            color: Color.fromRGBO(238, 238, 238, 1),
            borderRadius: BorderRadius.all(Radius.circular(5.0)),
          ),
          child: new ListView(
            children: <Widget>[
              new Padding(
                padding: new EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 15.0),
                child: new Container(
                  decoration: new BoxDecoration(
                    color: Colors.white,
                    borderRadius: BorderRadius.all(Radius.circular(5.0)),
                  ),
                  child: new Column(
                    children: <Widget>[
                      new Padding(
                          padding:
                              new EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
                          child: new Image.asset(
                            'resource/images/user/user4.png',
                          )),
                      new Padding(
                        padding:
                            new EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
                        child: new Center(
                          child: new Text(
                            '联系客服',
                            style: TextStyle(fontSize: 24),
                          ),
                        ),
                      ),
                      new Padding(
                          padding:
                              new EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
                          child: new Center(
                            child: new Text(
                              '我们将会全心全意为您提供满意周到的咨询服务。祝您生活愉快！',
                              style: TextStyle(fontSize: 14),
                            ),
                          )),
                      new Padding(
                          padding:
                              new EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
                          child: new RaisedButton.icon(
                            icon: new Image.asset(
                                'resource/images/user/user5.png'),
                            label: Text(
                              '400 017 2018',
                              style: TextStyle(fontSize: 24),
                            ),
                            color: Color.fromRGBO(255, 204, 48, 1),
                            textColor: Colors.white,
                            onPressed: () {
                              call();

                            },
                          )),
                      new Padding(
                          padding:
                              new EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
                          child: new RaisedButton.icon(
                            icon: new Image.asset(
                                'resource/images/user/wechat.png'),
                            label: Text(
                              'Wcwy8866',
                              style: TextStyle(fontSize: 24),
                            ),
                            color: Color.fromRGBO(255, 204, 48, 1),
                            textColor: Colors.white,
                            onPressed: () {
                              Clipboard.setData(ClipboardData(text: "Wcwy8866"));
                              Toast.show('微信号已复制', context);
                            },
                          )),
                    ],
                  ),
                ),
              )
            ],
          )),
    );
  }
}
